package com.sheepych.water_clock;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.StopWatch;

import java.text.DecimalFormat;
import java.util.TimeZone;

@SpringBootApplication
@EnableScheduling
public class WaterClockApplication {

    public static void main(String[] args) {
        runApp(WaterClockApplication.class, args);
    }

    public static void runApp(Class<?> primarySource, String... args) {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
        SpringApplication.run(primarySource, args);
        stopWatch.stop();
        System.out.printf("服务启动成功,启动耗时：%d毫秒(%s秒)%n", stopWatch.getTotalTimeMillis(), (new DecimalFormat("#.##")).format(stopWatch.getTotalTimeSeconds()));
    }

}
